package GUILayer;

import java.awt.EventQueue;

import javax.swing.JFrame;

import ModelLayer.*;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.Button;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MainGUI {

	private JFrame mainWindow;
	private Employee employee;
	private SaleGUI saleGUI;
	private LoginGUI loginGUI;

	/**
	 * Launch the application.
	 */
	
	

	/**
	 * Create the application.
	 */
	public MainGUI(Employee employee) {
		this.employee = employee;
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		mainWindow = new JFrame();
		mainWindow.setTitle("Hovedmenu");
		mainWindow.setBounds(100, 100, 450, 350);
		mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainWindow.getContentPane().setLayout(null);
		
		JButton saleBtn = new JButton("Salgsmenu");
		saleBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				saleGUI = new SaleGUI(employee);
				mainWindow.setVisible(false);
			}
		});
		saleBtn.setBounds(152, 22, 117, 55);
		mainWindow.getContentPane().add(saleBtn);
		
		JButton productBtn = new JButton("Varemenu");
		productBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				new ProductGUI();
			}
		});
		productBtn.setBounds(152, 88, 117, 55);
		mainWindow.getContentPane().add(productBtn);
		
		JButton personBtn = new JButton("Personmenu");
		personBtn.setBounds(152, 154, 117, 55);
		mainWindow.getContentPane().add(personBtn);
		
		JButton logoutBtn = new JButton("Logud");
		logoutBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				mainWindow.setVisible(false);
				loginGUI = new LoginGUI();
			}
		});
		logoutBtn.setBounds(152, 220, 117, 55);
		mainWindow.getContentPane().add(logoutBtn);
		
		JMenuBar menuBar = new JMenuBar();
		mainWindow.setJMenuBar(menuBar);
		
		JMenu fileMenu = new JMenu("Filer");
		menuBar.add(fileMenu);
		
		JMenuItem endProgramOption = new JMenuItem("Luk program");
		fileMenu.add(endProgramOption);
		
		JMenu helpMenu = new JMenu("Hj\u00E6lp");
		menuBar.add(helpMenu);
		
		JMenuItem aboutOption = new JMenuItem("Om");
		helpMenu.add(aboutOption);
		mainWindow.setVisible(true);
	}
	
}
